package at.fhooe.stefanirndorfer.resources;

import java.io.IOException;

import org.newdawn.slick.opengl.Texture;
import org.newdawn.slick.opengl.TextureLoader;
import org.newdawn.slick.util.ResourceLoader;

import at.fhooe.stefanirndorfer.logging.Log;


/**
 * primitive resource loader which does not care about double loaded resources
 * @author stefanirndorfer
 *
 */
public class ResLoader {

	public static String PATH = "res/";
	
	public ResLoader(){
		
	}
	
	
	public Texture loadTexture(String string){
		Texture texture = null;
		try {
			texture = TextureLoader.getTexture("PMG", ResourceLoader.getResourceAsStream(PATH+string));
			
			System.out.println("Texture loaded: "+texture);
			System.out.println(">> Image width: "+texture.getImageWidth());
			System.out.println(">> Image height: "+texture.getImageHeight());
			System.out.println(">> Texture width: "+texture.getTextureWidth());
			System.out.println(">> Texture height: "+texture.getTextureHeight());
			System.out.println(">> Texture ID: "+texture.getTextureID());
		
			
		} catch (IOException e) {
			Log.error(this, "Da hats was beim texture loaden");
			e.printStackTrace();
		}
		return texture;
	}
	
}
